using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableAuthPermissions
	{
		public const string Table = "AuthPermissions";
		public const string PermissionsID = "PermissionsID";
		public const string PermissionCode = "PermissionCode";
		public const string PermissionName = "PermissionName";
		public const string PermissionGroup = "PermissionGroup";
		public const string Description = "Description";
		public const string Url = "Url";
		public const string UerType = "UerType";
		public const string GroupSort = "GroupSort";
		public const string PermissionSort = "PermissionSort";
	}
	
	[Serializable]
	public class BaseAuthPermissions
		: IDbSessionEntity, IJsonClass
	{
		int m_PermissionsID;
		/// <summary>
        /// 权限ID(主键)
        /// </summary>
        public int PermissionsID
        {
            get { return m_PermissionsID; }
            set { m_PermissionsID = value; }
        }
		
		string m_PermissionCode;
		/// <summary>
        /// 权限编号
        /// </summary>
        public string PermissionCode
        {
            get { return m_PermissionCode; }
            set { m_PermissionCode = value; }
        }
		
		string m_PermissionName;
		/// <summary>
        /// 权限名称
        /// </summary>
        public string PermissionName
        {
            get { return m_PermissionName; }
            set { m_PermissionName = value; }
        }
		
		string m_PermissionGroup;
		/// <summary>
        /// 权限组
        /// </summary>
        public string PermissionGroup
        {
            get { return m_PermissionGroup; }
            set { m_PermissionGroup = value; }
        }
		
		string m_Description;
		/// <summary>
        /// 权限描述
        /// </summary>
        public string Description
        {
            get { return m_Description; }
            set { m_Description = value; }
        }
		
		string m_Url;
		/// <summary>
        /// 页面Url
        /// </summary>
        public string Url
        {
            get { return m_Url; }
            set { m_Url = value; }
        }
		
		int m_UerType;
		/// <summary>
        /// 用户权限类型
        /// </summary>
        public int UerType
        {
            get { return m_UerType; }
            set { m_UerType = value; }
        }
		
		int m_GroupSort;
		/// <summary>
        /// 组排序
        /// </summary>
        public int GroupSort
        {
            get { return m_GroupSort; }
            set { m_GroupSort = value; }
        }
		
		int m_PermissionSort;
		/// <summary>
        /// 权限组内排序
        /// </summary>
        public int PermissionSort
        {
            get { return m_PermissionSort; }
            set { m_PermissionSort = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_PermissionsID = reader[TableAuthPermissions.PermissionsID];
            m_PermissionCode = reader[TableAuthPermissions.PermissionCode];
            m_PermissionName = reader[TableAuthPermissions.PermissionName];
            m_PermissionGroup = reader[TableAuthPermissions.PermissionGroup];
            m_Description = reader[TableAuthPermissions.Description];
            m_Url = reader[TableAuthPermissions.Url];
            m_UerType = reader[TableAuthPermissions.UerType];
            m_GroupSort = reader[TableAuthPermissions.GroupSort];
            m_PermissionSort = reader[TableAuthPermissions.PermissionSort];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableAuthPermissions.PermissionsID, PrimaryKeyType.Identity, PermissionsID);
			writer[TableAuthPermissions.PermissionCode] = PermissionCode;
			writer[TableAuthPermissions.PermissionName] = PermissionName;
			writer[TableAuthPermissions.PermissionGroup] = PermissionGroup;
			writer[TableAuthPermissions.Description] = Description;
			writer[TableAuthPermissions.Url] = Url;
			writer[TableAuthPermissions.UerType] = UerType;
			writer[TableAuthPermissions.GroupSort] = GroupSort;
			writer[TableAuthPermissions.PermissionSort] = PermissionSort;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_PermissionsID = idd;
        }
		
		public string TableName
        {
            get { return TableAuthPermissions.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_PermissionsID = hashToRead["PermissionsID"];
			 
             m_PermissionCode = hashToRead["PermissionCode"];
			 
             m_PermissionName = hashToRead["PermissionName"];
			 
             m_PermissionGroup = hashToRead["PermissionGroup"];
			 
             m_Description = hashToRead["Description"];
			 
             m_Url = hashToRead["Url"];
			 
             m_UerType = hashToRead["UerType"];
			 
             m_GroupSort = hashToRead["GroupSort"];
			 
             m_PermissionSort = hashToRead["PermissionSort"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["PermissionsID"] = PermissionsID;
			 
            hashToFill["PermissionCode"] = PermissionCode;
			 
            hashToFill["PermissionName"] = PermissionName;
			 
            hashToFill["PermissionGroup"] = PermissionGroup;
			 
            hashToFill["Description"] = Description;
			 
            hashToFill["Url"] = Url;
			 
            hashToFill["UerType"] = UerType;
			 
            hashToFill["GroupSort"] = GroupSort;
			 
            hashToFill["PermissionSort"] = PermissionSort;
			 
        }

        #endregion
		
	}
}
